<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Schema;

class CreateTeachingMaterialsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('teaching_materials', function (Blueprint $table) {
            $table->id();
            $table->unsignedInteger('mechanism_id')->default(0)->comment('所属机构');
            $table->string('name')->default('')->comment('教材名称');
            $table->unsignedInteger('number')->default(0)->comment('单元数量');
            $table->timestamps();
        });
        DB::statement("ALTER TABLE `teaching_materials` comment '教材表'");
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('teaching_materials');
    }
}
